<?php

require_once('UserController.php');

function CheckUser($login,$sha1)
{
	
  $userHandler = new UserController();
  if($login=="user" && $sha1=="ab4f63f9ac65152575886860dde480a1") // MD5 de azerty
    return true;
  return false;
}
?>
<?php
if(!isset($_POST['sha1']))
{
  header("Location: ../login.php");
  die();
}
$sha1=$_POST['sha1'];

if(!isset($_POST['login']))
{
  header("Location: ../login.php");
  die();
}
$login=$_POST['login'];

if(!CheckUser($login,$sha1))
{
  header("Location: ../login.php");
  die();
}

session_start();

$_SESSION['last_access']=time();
$_SESSION['ipaddr']=$_SERVER['REMOTE_ADDR'];
$_SESSION['user']=$login;

header("Location: ../page.php");
?>
